package day_17.FanShe;

public class ReflectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException {
        //1.Class类中的静态方法forName("全类名")
        //全类名:包名 + 类名
        Class aClass = Class.forName("day_17.FanShe.Student");
        System.out.println(aClass);
        //2.通过class属性来获取
        Class aClass1 = Student.class;

        System.out.println(aClass1);

        //3.利用对象的getClass方法来获取class对象
        //getClass方法是定义在Object类中.
        Student s = new Student();
        Class aClass2 = s.getClass();
        System.out.println(aClass2);

        System.out.println(aClass==aClass1);
        System.out.println(aClass1==aClass2);
    }
}

class lx01{
    public static void main(String[] args) throws ClassNotFoundException {
        Class clazz = Class.forName("day_17.FanShe.Student");
        System.out.println(clazz);
        Class clazz1 = Student.class;
        System.out.println(clazz1);
        Student student = new Student();
        Class clazz2 = student.getClass();

        System.out.println(clazz==clazz1);
        System.out.println(clazz1==clazz2);
    }
}
class lx02{
    public static void main(String[] args) throws ClassNotFoundException {
        Class clazz = Class.forName("day_17.FanShe.Student");
        System.out.println(clazz);
        Class clazz1 = Student.class;
        System.out.println(clazz1);
        Student student = new Student();
        Class clazz2 = student.getClass();
        System.out.println(clazz==clazz1);
        System.out.println(clazz1==clazz2);
    }
}
